TEMPORALS

Relative Rank of the States for Nine Decades (1790-1870)

Rank Chart a.k.a. Bump

Photo by Clark Young on Unsplash

Photo by Clark Young on Unsplash

The state comes into existence for the sake of life and continues to exist for the sake of good life…
— Aristotle


Load data [Ingest]

state_ranks_df = read.csv("archetypes/us-state-populations/relative-rank-of-us-state-populations-1790-1870.csv", header = TRUE, stringsAsFactors = TRUE)
state_ranks_df

Prepare data [Wrangle]

# Create ordered factor for year
state_ranks_df$YEAR <- factor(state_ranks_df$YEAR, ordered = TRUE, levels = c("1790", "1800", "1810", "1820", "1830", "1840", "1850", "1860", "1870"))
state_ranks_df

Plot [ Views / Temporals ]

plot_specs <- list(  
  # move the x axis labels up top
  scale_x_discrete(position = "top"),
  theme_tufte(),
  theme( plot.margin = unit(c(0,3,0,3), "cm") ),
  # Format tweaks
  # Remove the legend
  theme(legend.position = "none"),
  # Remove the panel border
  theme(panel.border     = element_blank()),
  # Remove just about everything from the y axis
  theme(axis.title.y     = element_blank()),
  theme(axis.text.y      = element_blank()),
  theme(panel.grid.major.y = element_blank()),
  theme(panel.grid.minor.y = element_blank()),
  # Remove a few things from the x axis and increase font size
  theme(axis.title.x     = element_blank()),
  theme(panel.grid.major.x = element_blank()),
  theme(axis.text.x.top      = element_text(size=12)),
  # Remove x & y tick marks
  theme(axis.ticks       = element_blank()),
  # Format title & subtitle
  theme(plot.title       = element_text(size=14, face = "bold")),
  theme(plot.subtitle    = element_text())
)

v1 <- ggplot(data = state_ranks_df, aes(x = YEAR, y = RANK, group = STATE)) +
  geom_line(color="black", size = 0.5, alpha = 1) +
  geom_text(data = state_ranks_df %>% group_by(STATE) %>% filter(row_number()==1), 
                  aes(label = paste0(STATE)) , 
                  hjust = "right",
                  nudge_x = -0.1,
                  nudge_y = 0.05, 
                  #fontface = "bold", 
                  size = 2.5) +
  geom_text(data = state_ranks_df %>% filter(YEAR == "1870"), 
                  aes(label = paste0(STATE)), 
                  hjust = "left",
                  nudge_x = 0.1,
                  nudge_y = 0.05, 
                  #fontface = "bold", 
                  size = 2.5) +
  geom_point(shape = 21, color = "white", fill="white", size = 4.0, stroke = 1, alpha = 1) +
  geom_text(aes(label = RANK), 
                  color="black", 
                  alpha = 1,
                  size = 2.0,
                  nudge_y = 0.05) +
  scale_y_reverse() +
  # Important to remove clipping for long y axis labels
  coord_cartesian(clip = "off") +
  plot_specs +
  labs(
    title = "Chart Exhibiting the Relative Rank of the States for Nine Decades (1790-1870)",
    subtitle = "1878, The National Atlas.",
    caption = "source: David Rumsey Historical Map Collection"
  )

# state_rank_plot

girafe(ggobj = v1, width_svg = 16, height_svg = 15,
       options = list(opts_sizing(rescale = TRUE, width = 0.9)))
# ggsave(filename = "relative-rank-of-us-state-populations-1790-1870.svg", plot = state_rank_plot, width=13.33, height=7.5)

References

The citations and data sources used for this case

  • Narrative inspiration: David Rumsey, GO